package jdbcRflect;

import javax.swing.*;
import java.lang.reflect.InvocationTargetException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class TestTools {
    public static void main(String[] args) throws SQLException, InvocationTargetException, InstantiationException, IllegalAccessException {
//        System.out.println("JdbcTools.getConnection() = " + JdbcTools.getConnection());
//        int i=JdbcTools.update1("update student set name=? where name=?","李晨","cc");
//        System.out.println(i);
//
//        student student = JdbcTools.queryBean("select * from student where id =?", student.class, 1);
//        System.out.println("student = " + student);
//
//        List<student> list = JdbcTools.queryBeanList("select * from student ", student.class);
//        System.out.println("list = " + list);

//        ArrayList<Map> lichen = JdbcTools.queryMapList("select * from student where name = ?",  "李晨");
//        System.out.println("lichen = " + lichen);

//        Object[] objects = JdbcTools.queryArray("select * from student where name = ?", "李晨");
//        System.out.println("objects = " + objects);
//        System.out.println("Arrays.toString(objects) = " + Arrays.toString(objects));

        List<Object[]> lichen1= JdbcTools.queryArrayList("select * from student");
        System.out.println("lichen1 = " + lichen1);
        for (int i = 0; i < lichen1.size(); i++) {
            System.out.println(Arrays.toString(lichen1.get(i)));
        }

//        Map ee = JdbcTools.queryMap("select * from student where name = ?", "ee");
//        System.out.println("ee = " + ee);


    }
}
